#include<stdio.h>
int main()
{
	int total=0,money=0,bottle=0;
	scanf("%d",&money);
	while(money)
	{
		total+=money;
		bottle+=money;
		money=bottle/2;
		bottle%=2;
	}
	printf("%d",total);
	return 0;
}
